/** 该文件仅存放分享模块相关的接口API */
import myaxios from "../MyAxios";
// 引入路径前缀
import BASEURL from "../BaseUrl";
const { BMDURL } = BASEURL;

const shareApi = {
  /**
   * 新增分享
   * @param {Object}} params  {title,detail}
   */
  shareAdd(params) {
    return myaxios.post(BMDURL + "/v1/share/add", params);
  },

  /**
   * 通过sid查询发布的内容
   * @param {Object}} params  {uid,sid}
   */
  shareById(params) {
    return myaxios.get(BMDURL + "/v1/share", params);
  },
  /**
   * 通过uid查询发布的内容
   * @param {Object}} params  {uid,sid}
   */
  shareByUid(params) {
    return myaxios.get(BMDURL + "/v1/share/byuid", params);
  },

  /**
   * 通过uid查询用户的信息
   * @param {Object}} params  {uid}
   */
  shareUserByUid(params) {
    return myaxios.get(BMDURL + "/v1/share/user", params);
  },

  /**
   * 查询所有发布内容
   * @param {Object}} params  {}
   */
  shareType(params) {
    return myaxios.get(BMDURL + "/v1/share/all", params);
  },

  /**
   * 删除发布的内容
   * @param {Object}} params  {sid}
   */
  shareDelete(params) {
    return myaxios.post(BMDURL + "/v1/share/delete", params);
  },

  /**
   * 更新发布的内容
   * @param {Object}} params  {title,pic,detail,sid}
   */
  shareUpdate(params) {
    return myaxios.post(BMDURL + "/v1/share/update", params);
  },
};

export default shareApi;
